////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// THIS IS AUTO-GENERATED CODE.  PLEASE DO NOT EDIT (File bug reports against tools).
///
/// Auto-generated by: ParameterParser V1.1.4
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  afalgotuningelements.cpp
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include "afalgotuningelements.h"
#include "parametersetmanager.h"

AFALGOTUNINGELEMENTS_NAMESPACE_BEGIN

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Default Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixAFAlgoTuningTypeClass::chromatixAFAlgoTuningTypeClass(
    const CHAR* name)
    : ParameterModule(name, MAJOR, MINOR, PATCH, 0, 0, 0, 0)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(commonElements);
    PARAMETER_INITIALIZE(FOVCorrection);
    PARAMETER_INITIALIZE(searchLimitCount);
    PARAMETER_INITIALIZE(searchLimitID);
    PARAMETER_INITIALIZE(searchLimit);
    PARAMETER_INITIALIZE(faceDetection);
    PARAMETER_INITIALIZE(orientationDetection);
    PARAMETER_INITIALIZE(outdoorROIConfiguration);
    PARAMETER_INITIALIZE(moduleTuning);
    PARAMETER_INITIALIZE(setInvalidFrame);
    PARAMETER_INITIALIZE(handJitter);
    PARAMETER_INITIALIZE(spotlightDetection);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixAFAlgoTuningTypeClass::chromatixAFAlgoTuningTypeClass(
    const CHAR* name,
    UINT32 modeId,
    UINT16 mode,
    UINT16 subMode,
    UINT32 group)
    : ParameterModule(name, MAJOR, MINOR, PATCH, modeId, mode, subMode, group)
{
    PARAMETER_INITIALIZE(SymbolTableID);
    PARAMETER_INITIALIZE(module_version);
    PARAMETER_INITIALIZE(parameter_version);
    PARAMETER_INITIALIZE(commonElements);
    PARAMETER_INITIALIZE(FOVCorrection);
    PARAMETER_INITIALIZE(searchLimit);
    PARAMETER_INITIALIZE(faceDetection);
    PARAMETER_INITIALIZE(orientationDetection);
    PARAMETER_INITIALIZE(outdoorROIConfiguration);
    PARAMETER_INITIALIZE(moduleTuning);
    PARAMETER_INITIALIZE(setInvalidFrame);
    PARAMETER_INITIALIZE(handJitter);
    PARAMETER_INITIALIZE(spotlightDetection);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
chromatixAFAlgoTuningTypeClass::~chromatixAFAlgoTuningTypeClass()
{
    UnloadchromatixAFAlgoTuningType(this);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// GetName
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const CHAR* chromatixAFAlgoTuningTypeClass::GetName(
    const CHAR* type)
{
    const CHAR* name = type;
    CHAR temp[ParameterFileSymbolTableEntry::TYPE_LEN + 1];
    if (PARAMETER_STRCMP(type, ParameterFileSymbolTableEntry::GetType(temp, "chromatixAFAlgoTuning")) == 0)
    {
        name = "chromatixAFAlgoTuning";
    }
    return name;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixSagCompensation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixSagCompensation(
    ParameterFileSymbolTableEntry* entry,
    chromatixSagCompensation* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->enable);

    // Reading structure->fDAC from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->fDACCount);
        structure->fDACID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->fDAC   = PARAMETER_NEW UINT32[structure->fDACCount];
        }
        if (!result || structure->fDAC == NULL)
        {
            structure->fDACCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->fDACCount; i++)
        {
            result = result && pointerEntry1->ReadUInt32(&structure->fDAC[i]);
        }
    }
    result = result && entry->ReadFloat(&structure->fDistance);
    result = result && entry->ReadFloat(&structure->triggerThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixModuleTuningReserveType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixModuleTuningReserveType(
    ParameterFileSymbolTableEntry* entry,
    chromatixModuleTuningReserveType* structure)
{
    BOOL result = TRUE;
    result = result && LoadchromatixSagCompensation(entry, &structure->lensSagCompensation);
    result = result && entry->ReadInt32(&structure->enableHysteresisOffset);
    result = result && entry->ReadInt32(&structure->chromatixHysteresisOffset);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixAFOutdoorConfigurationReserveType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixAFOutdoorConfigurationReserveType(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFOutdoorConfigurationReserveType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->EnableOutdoorROITune);
    result = result && entry->ReadFloat(&structure->OutdoorROIRatioX);
    result = result && entry->ReadFloat(&structure->OutdoorROIRatioY);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixAFOrientationDetectionReserveType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixAFOrientationDetectionReserveType(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFOrientationDetectionReserveType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->gravityXLandscapeThreshold);
    result = result && entry->ReadFloat(&structure->gravityYLandscapeThreshold);
    result = result && entry->ReadFloat(&structure->gravityXPortraitThreshold);
    result = result && entry->ReadFloat(&structure->gravityYPortraitThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixAFFaceDetectionReserveType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixAFFaceDetectionReserveType(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFFaceDetectionReserveType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->robustFaceDetectEnable);
    result = result && entry->ReadInt32(&structure->nofaceCountThreshold);
    result = result && entry->ReadInt32(&structure->stableCountThreshold);
    result = result && entry->ReadFloat(&structure->faceDetectionROIPositionChangeThreshold);
    result = result && entry->ReadInt32(&structure->faceLostTriggerEnable);
    result = result && entry->ReadInt32(&structure->faceLostStableThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixAFFaceDetectionROITuningReserveType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixAFFaceDetectionROITuningReserveType(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFFaceDetectionROITuningReserveType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->FDROITune);
    result = result && entry->ReadFloat(&structure->FDROIRatio);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixAFFaceROIExtensionReserveType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixAFFaceROIExtensionReserveType(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFFaceROIExtensionReserveType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->ROIFaceExtensionEnable);
    result = result && entry->ReadFloat(&structure->ROIFaceScaleX);
    result = result && entry->ReadFloat(&structure->ROIFaceScaleY);
    result = result && entry->ReadFloat(&structure->ROIFaceSymmetricX);
    result = result && entry->ReadFloat(&structure->ROIFaceSymmetricY);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixFDPriorityCAF
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixFDPriorityCAF(
    ParameterFileSymbolTableEntry* entry,
    chromatixFDPriorityCAF* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadFloat(&structure->positionChangeThreshold);
    result = result && entry->ReadFloat(&structure->positionStableThresholdHigh);
    result = result && entry->ReadFloat(&structure->positionStableThresholdLow);
    result = result && entry->ReadFloat(&structure->sizeChangeThreshold);
    result = result && entry->ReadFloat(&structure->oldNewSizeDifferenceThreshold);
    result = result && entry->ReadInt32(&structure->stableCountSize);
    result = result && entry->ReadInt32(&structure->stableCountPosition);
    result = result && entry->ReadInt32(&structure->noFaceWaitThreshold);
    result = result && entry->ReadInt32(&structure->fpsAdjustmentThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixFaceDetectionTuningType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixFaceDetectionTuningType(
    ParameterFileSymbolTableEntry* entry,
    chromatixFaceDetectionTuningType* structure)
{
    BOOL result = TRUE;
    result = result && LoadchromatixFDPriorityCAF(entry, &structure->faceDetectionPriority);
    result = result && LoadchromatixAFFaceROIExtensionReserveType(entry, &structure->faceROIExtension);
    result = result && LoadchromatixAFFaceDetectionROITuningReserveType(entry, &structure->faceDetectionROITuning);
    result = result && LoadchromatixAFFaceDetectionReserveType(entry, &structure->faceDetection);
    result = result && LoadchromatixFaceDetectionTuningType_faceHVWeightStruct(entry, &structure->faceHVWeight);
    result = result && LoadchromatixFaceDetectionTuningType_faceFarEndStruct(entry, &structure->faceFarEnd);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixFaceDetectionTuningType_faceHVWeightStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixFaceDetectionTuningType_faceHVWeightStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixFaceDetectionTuningType::faceHVWeightStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadFloat(&structure->hWeight);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixFaceDetectionTuningType_faceFarEndStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixFaceDetectionTuningType_faceFarEndStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixFaceDetectionTuningType::faceFarEndStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->enable);
    result = result && entry->ReadInt32(&structure->farEnd);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixFocusModeSearchLimitType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixFocusModeSearchLimitType(
    ParameterFileSymbolTableEntry* entry,
    chromatixFocusModeSearchLimitType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->enable);
    result = result && entry->ReadUInt32(&structure->nearEnd);
    result = result && entry->ReadUInt32(&structure->farEnd);
    result = result && entry->ReadUInt32(&structure->defaultPosition);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixFOVCorrection
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixFOVCorrection(
    ParameterFileSymbolTableEntry* entry,
    chromatixFOVCorrection* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->enable);
    result = result && entry->ReadFloat(&structure->fudgeFactor);
    result = result && entry->ReadInt32(&structure->anchorLensPosition1);
    result = result && entry->ReadInt32(&structure->anchorLensPosition2);
    result = result && entry->ReadInt32(&structure->anchorDistanceMM1);
    result = result && entry->ReadInt32(&structure->anchorDistanceMM2);
    result = result && entry->ReadInt32(&structure->focusConvergeStepSizeBrightLight);
    result = result && entry->ReadInt32(&structure->fineSearchStepSizeBrightLight);
    result = result && entry->ReadInt32(&structure->focusConvergeStepSizeLowLight);
    result = result && entry->ReadInt32(&structure->fineSearchStepSizeLowLight);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixAFCommonType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixAFCommonType(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFCommonType* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->positionNearEnd);
    result = result && entry->ReadInt32(&structure->positionDefaultInMacro);
    result = result && entry->ReadInt32(&structure->positionBoundary);
    result = result && entry->ReadInt32(&structure->positionDefaultInNormal);
    result = result && entry->ReadInt32(&structure->positionFarEnd);
    result = result && entry->ReadInt32(&structure->positionNormalHyperfocal);
    result = result && entry->ReadInt32(&structure->positionMacroRegion);
    result = result && entry->ReadInt32(&structure->lowLightGainThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load chromatixAFAlgoTuningType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadchromatixAFAlgoTuningType(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType* structure)
{
    BOOL result = TRUE;
    result = result && Loadmodule_versionStruct(entry, &structure->module_version);
    result = result && Loadparameter_versionStruct(entry, &structure->parameter_version);
    result = result && LoadchromatixAFCommonType(entry, &structure->commonElements);
    result = result && LoadchromatixFOVCorrection(entry, &structure->FOVCorrection);

    // Reading structure->searchLimit from the symbol table
    {
        result = result && entry->ReadUInt32(&structure->searchLimitCount);
        structure->searchLimitID = entry->ID;
        ParameterFileSymbolTableEntry* pointerEntry1 = entry->Table->ReadPointerEntry(entry);
        result = result && pointerEntry1 != NULL;
        if (result)
        {
            structure->searchLimit   = PARAMETER_NEW chromatixFocusModeSearchLimitType[structure->searchLimitCount];
        }
        if (!result || structure->searchLimit == NULL)
        {
            structure->searchLimitCount = 0;
        }
        for (UINT32 i = 0; result && i < structure->searchLimitCount; i++)
        {
            result = result && LoadchromatixFocusModeSearchLimitType(pointerEntry1, &structure->searchLimit[i]);
        }
    }
    result = result && LoadchromatixFaceDetectionTuningType(entry, &structure->faceDetection);
    result = result && LoadchromatixAFOrientationDetectionReserveType(entry, &structure->orientationDetection);
    result = result && LoadchromatixAFOutdoorConfigurationReserveType(entry, &structure->outdoorROIConfiguration);
    result = result && LoadchromatixModuleTuningReserveType(entry, &structure->moduleTuning);
    result = result && entry->ReadInt32(&structure->setInvalidFrame);
    result = result && LoadhandJitterStruct(entry, &structure->handJitter);
    result = result && LoadspotlightDetectionStruct(entry, &structure->spotlightDetection);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load module_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::Loadmodule_versionStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::module_versionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->major_revision);
    result = result && entry->ReadInt32(&structure->minor_revision);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load parameter_versionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::Loadparameter_versionStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::parameter_versionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadInt32(&structure->major_revision);
    result = result && entry->ReadInt32(&structure->minor_revision);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct* structure)
{
    BOOL result = TRUE;
    result = result && LoadhandJitterStruct_AFSingleStruct(entry, &structure->AFSingle);
    result = result && LoadhandJitterStruct_HAFFineSearchStruct(entry, &structure->HAFFineSearch);
    result = result && entry->ReadUInt32(&structure->samplingRate);
    result = result && entry->ReadUInt32(&structure->reportingRate);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct_AFSingleStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct_AFSingleStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct::AFSingleStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadFloat(&structure->maxFVInBeginning);
    result = result && LoadhandJitterStruct_handJitterStruct_AFSingleStruct_coarseSearchStruct(entry, &structure->coarseSearch);
    result = result && LoadhandJitterStruct_handJitterStruct_AFSingleStruct_fineSearchStruct(entry, &structure->fineSearch);
    result = result && entry->ReadFloat(&structure->redoRateThreshold);
    result = result && entry->ReadUInt32(&structure->handleNeedCount);
    result = result && entry->ReadBoolean(&structure->resetDataBeforeFineSearch);
    result = result && entry->ReadUInt32(&structure->workingExposureIndex);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct_handJitterStruct_AFSingleStruct_coarseSearchStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct_handJitterStruct_AFSingleStruct_coarseSearchStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct::AFSingleStruct::coarseSearchStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->minSampleSize);
    result = result && entry->ReadFloat(&structure->currentGyroscopeThreshold);
    result = result && entry->ReadFloat(&structure->currentGyroscopeSTDThreshold);
    result = result && entry->ReadFloat(&structure->gyroscopeThresholdForDifferenceRatio);
    result = result && entry->ReadFloat(&structure->gyroscodeDifferenceRatioThreshold);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct_handJitterStruct_AFSingleStruct_fineSearchStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct_handJitterStruct_AFSingleStruct_fineSearchStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct::AFSingleStruct::fineSearchStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->minSampleSize);
    result = result && entry->ReadFloat(&structure->currentGyroscopeThreshold);
    result = result && entry->ReadFloat(&structure->currentGyroscopeSTDThreshold);
    result = result && entry->ReadFloat(&structure->gyroscopeThresholdForDifferenceRatio);
    result = result && entry->ReadFloat(&structure->gyroscodeDifferenceRatioThreshold);
    result = result && LoadhandJitterStruct_handJitterStruct_AFSingleStruct_handJitterStruct_handJitterStruct_AFSingleStruct_fineSearchStruct_FVNormalizedStruct(entry, &structure->FVNormalized);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct_handJitterStruct_AFSingleStruct_handJitterStruct_handJitterStruct_AFSingleStruct_fineSearchStruct_FVNormalizedStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct_handJitterStruct_AFSingleStruct_handJitterStruct_handJitterStruct_AFSingleStruct_fineSearchStruct_FVNormalizedStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct::AFSingleStruct::fineSearchStruct::FVNormalizedStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadFloat(&structure->highGyroscopeDifferenceThreshold);
    result = result && entry->ReadFloat(&structure->lowGyroscopeDifferenceThreshold);
    result = result && entry->ReadFloat(&structure->highGryoscopeFVWeight);
    result = result && entry->ReadUInt32(&structure->weightType);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct_HAFFineSearchStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct_HAFFineSearchStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct::HAFFineSearchStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && LoadhandJitterStruct_handJitterStruct_HAFFineSearchStruct_fineSearchStruct(entry, &structure->fineSearch);
    result = result && entry->ReadUInt32(&structure->handleNeedCount);
    result = result && entry->ReadUInt32(&structure->workingExposureIndex);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct_handJitterStruct_HAFFineSearchStruct_fineSearchStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct_handJitterStruct_HAFFineSearchStruct_fineSearchStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct::HAFFineSearchStruct::fineSearchStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadUInt32(&structure->minSampleSize);
    result = result && entry->ReadFloat(&structure->currentGyroscopeThreshold);
    result = result && entry->ReadFloat(&structure->currentGyroscopeSTDThreshold);
    result = result && entry->ReadFloat(&structure->gyroscopeThresholdForDifferenceRatio);
    result = result && entry->ReadFloat(&structure->gyroscodeDifferenceRatioThreshold);
    result = result && LoadhandJitterStruct_handJitterStruct_HAFFineSearchStruct_handJitterStruct_handJitterStruct_HAFFineSearchStruct_fineSearchStruct_FVNormalizedStruct(entry, &structure->FVNormalized);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load handJitterStruct_handJitterStruct_HAFFineSearchStruct_handJitterStruct_handJitterStruct_HAFFineSearchStruct_fineSearchStruct_FVNormalizedStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadhandJitterStruct_handJitterStruct_HAFFineSearchStruct_handJitterStruct_handJitterStruct_HAFFineSearchStruct_fineSearchStruct_FVNormalizedStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::handJitterStruct::HAFFineSearchStruct::fineSearchStruct::FVNormalizedStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadFloat(&structure->highGyroscopeDifferenceThreshold);
    result = result && entry->ReadFloat(&structure->lowGyroscopeDifferenceThreshold);
    result = result && entry->ReadFloat(&structure->highGryoscopeFVWeight);
    result = result && entry->ReadUInt32(&structure->weightType);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Load spotlightDetectionStruct
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BOOL chromatixAFAlgoTuningTypeClass::LoadspotlightDetectionStruct(
    ParameterFileSymbolTableEntry* entry,
    chromatixAFAlgoTuningType::spotlightDetectionStruct* structure)
{
    BOOL result = TRUE;
    result = result && entry->ReadBoolean(&structure->enable);
    result = result && entry->ReadInt32(&structure->statsType);
    result = result && entry->ReadInt32(&structure->bgStatsThreshAutoConvertEnable);
    result = result && entry->ReadFloat(&structure->bgStatsBrightRegionSatRatioThresh);
    result = result && entry->ReadFloat(&structure->far_flat_th);
    result = result && entry->ReadFloat(&structure->marco_flat_th);
    result = result && entry->ReadFloat(&structure->inc_flat_th);
    result = result && entry->ReadFloat(&structure->dec_flat_th);
    result = result && entry->ReadUInt32(&structure->spotlight_zone_start_h);
    result = result && entry->ReadUInt32(&structure->spotlight_zone_end_h);
    result = result && entry->ReadUInt32(&structure->spotlight_zone_start_v);
    result = result && entry->ReadUInt32(&structure->spotlight_zone_end_v);
    result = result && entry->ReadUInt32(&structure->background_zone_start_h);
    result = result && entry->ReadUInt32(&structure->background_zone_end_h);
    result = result && entry->ReadUInt32(&structure->background_zone_start_v);
    result = result && entry->ReadUInt32(&structure->background_zone_end_v);
    result = result && entry->ReadInt32(&structure->exposure_index_trigger_th);
    result = result && entry->ReadUInt32(&structure->background_luma_avg_th);
    result = result && entry->ReadUInt32(&structure->region_low_grey_th);
    result = result && entry->ReadUInt32(&structure->region_low_dark_th);
    result = result && entry->ReadFloat(&structure->background_low_grey_pct_th);
    result = result && entry->ReadFloat(&structure->background_dark_grey_pct_th);
    result = result && entry->ReadFloat(&structure->bright_region_luma_delta_background_zone);
    result = result && entry->ReadFloat(&structure->bright_region_luma_delta_spotlight_zone_low_grey);
    result = result && entry->ReadFloat(&structure->bright_region_luma_delta_spotlight_zone_dark_grey);
    result = result && entry->ReadUInt32(&structure->square_cluster_inc_size);
    result = result && entry->ReadUInt32(&structure->vertical_cluster_inc_size);
    result = result && entry->ReadUInt32(&structure->horizontal_cluster_inc_size);
    result = result && entry->ReadFloat(&structure->square_cluster_pct_th);
    result = result && entry->ReadFloat(&structure->vertical_cluster_pct_th);
    result = result && entry->ReadFloat(&structure->horizontal_cluster_pct_th);
    result = result && entry->ReadUInt32(&structure->spotlight_detect_cnt_th);

    return result;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixSagCompensation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixAFAlgoTuningTypeClass::UnloadchromatixSagCompensation(
    chromatixSagCompensation* structure)
{
    PARAMETER_DELETE[] structure->fDAC;
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixModuleTuningReserveType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixAFAlgoTuningTypeClass::UnloadchromatixModuleTuningReserveType(
    chromatixModuleTuningReserveType* structure)
{
    UnloadchromatixSagCompensation(&structure->lensSagCompensation);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Unload chromatixAFAlgoTuningType
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void chromatixAFAlgoTuningTypeClass::UnloadchromatixAFAlgoTuningType(
    chromatixAFAlgoTuningType* structure)
{
    PARAMETER_DELETE[] structure->searchLimit;
    UnloadchromatixModuleTuningReserveType(&structure->moduleTuning);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Parse symbol table entry, and return a new object
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParameterModule* chromatixAFAlgoTuningTypeClass::Parse(
    ParameterSetManager* manager,
    ParameterFileSymbolTableEntry* entry) const
{
    chromatixAFAlgoTuningTypeClass* cls = NULL;

    if (PARAMETER_STRCMP(Type, entry->Type) == 0 && Major == entry->Major &&
        Minor == entry->Minor && Patch == entry->Patch)
    {
        cls = PARAMETER_NEW chromatixAFAlgoTuningTypeClass(GetName(entry->Type), 
            entry->ModeId, entry->Mode, entry->SubMode, entry->Group);
        if (cls != NULL)
        {
            BOOL result = TRUE;

            cls->SymbolTableID = entry->ID;
            cls->ID            = entry->ID;

            result = result && LoadchromatixAFAlgoTuningType(entry, cls);

            if (!result)
            {
                PARAMETER_DELETE cls;
                cls = NULL;
            }
        }
    }
    return (ParameterModule*)cls;
}


AFALGOTUNINGELEMENTS_NAMESPACE_END
